package com.odais.json;

import java.util.HashMap;

/**
 *
 * @author Lionel DECELLE
 * @since 8 juin 2012 - 10:52:13
 *
 */
public class JSON_Seller_Action_Reservation {

    //Register it to ODAIS DB
    static String JSON_Buffer[] = new String[6];
    static HashMap<String, ?> JSON_BufferOut;
	//String JSON_BufferOut[];
	static HashMap<String, String> datahash = new HashMap<String, String>();
	static String TfResult = new String();

    public static String JSON_Seller_Action_Accept_Reservation(String ResNum)
    {
		JSON_Buffer[0] = "action";
		JSON_Buffer[1] = "SaveReDB";
		JSON_Buffer[2] = "numrsv";
		JSON_Buffer[3] = ResNum;
		JSON_Buffer[4] = "status";
		JSON_Buffer[5] = "1000";		// validate

		JSON_IO_Interface jsonPost = new JSON_IO_Interface();
		JSON_BufferOut = (HashMap<String, ?>) jsonPost.JSON_Post(JSON_Buffer);

		try {
			datahash = (HashMap<String, String>) JSON_BufferOut.get("0");
			TfResult = datahash.get("success").toString();
		} catch (Exception e) {
			e.printStackTrace();
			TfResult = "No valid response from server!";
		}

		return TfResult;

    }

    public static String JSON_Seller_Action_Decline_Reservation(String ResNum)
    {
		JSON_Buffer[0] = "action";
		JSON_Buffer[1] = "SaveReDB";
		JSON_Buffer[2] = "numrsv";
		JSON_Buffer[3] = ResNum;
		JSON_Buffer[4] = "status";
		JSON_Buffer[5] = "0000";		// decline

		JSON_IO_Interface jsonPost = new JSON_IO_Interface();
		JSON_BufferOut = (HashMap<String, ?>) jsonPost.JSON_Post(JSON_Buffer);
		try {
			datahash = (HashMap<String, String>) JSON_BufferOut.get("0");
			TfResult = datahash.get("success").toString();
		} catch (Exception e) {
			e.printStackTrace();
			TfResult = "No valid response from server!";
		}

		return TfResult;

    }
}
